#include <stdio.h>
#include <stdlib.h>
#include <memory.h>

static int normalize(const char *s)
{
    static const char alpha_map[27] = "2223334445556667-77888999-";
    int ret = 0;
    for (; *s; s++)
    {
        char c = *s;
        int d;
        if (c >= '0' && c <= '9')
            d = c - '0';
        else if (c >= 'A' && c <= 'Z')
            d = alpha_map[c - 'A'] - '0';
        else
            continue;
        ret = ret * 10 + d;
    }
    return ret;
}

#define MAX_ITEMS   100000
#define BUCKET_SIZE 200003

typedef struct Node 
{
    int number; /* telephone number */
    int times;  /* number of times this number appears */
    int next;   /* index to next node + 1 */
} Node;

static Node items[MAX_ITEMS];   /* array of nodes */
static int num_items;           /* number of nodes */
static int head[BUCKET_SIZE];   /* index to first node + 1 */

static int item_comparer(const Node *n1, const Node *n2)
{
    return n1->number - n2->number;
}

int main()
{
    int n, i, hash;
    int num_dups, j;

    memset(head, 0, sizeof(head));
    num_items = 0;

    /* Input phone numbers. */
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        char buffer[100];
        int number, k;
        scanf("%s", buffer);
        number = normalize(buffer);

        /* Find entry in hash table. */
        hash = number % BUCKET_SIZE;
        for (k = head[hash]; 
             k != 0 && items[k-1].number != number; 
             k = items[k-1].next);

        if (k == 0) /* no item yet */
        {
            k = num_items++;
            items[k].next = head[hash];
            items[k].number = number;
            items[k].times = 1;
            head[hash] = k + 1;
        }
        else
        {
            items[k-1].times++;
        }
    }

    /* Filter the items array to keep only those with dups. */
    for (i = j = 0; i < num_items; i++)
    {
        if (items[i].times > 1)
        {
            if (i != j)
                items[j] = items[i];
            j++;
        }
    }
    num_dups = j;

    if (num_dups == 0)
    {
        printf("No duplicates.\n");
    }
    else
    {
        /* Sort the array by telephone number. */
        qsort(items, num_dups, sizeof(items[0]), item_comparer);
        for (i = 0; i < num_dups; i++)
        {
            int number = items[i].number, times = items[i].times;
            printf("%03d-%04d %d\n", number / 10000, number % 10000, times);
        }
    }
    return 0;
}
